package pro.softzhang.algo.lc0;

import pro.softzhang.algo.flag.knowledge.KDoublePointer;

/**
 *
 */
public class LC26_RemoveDuplicatesFromSortedArray {
    public static void main(String[] args) {
        int[] nums = {1,1,2};

    }

    @KDoublePointer
    static
    class Solution {
        public int removeDuplicates(int[] nums) {
            int i = 0, j = 0;
            while (j < nums.length) {
                if (i == 0 || nums[i - 1] != nums[j]) {
                    nums[i++] = nums[j];
                }
                j++;
            }
            return i;
        }
    }
}
